package com.tcxhb.job.core.service.job;

import com.tcxhb.job.dao.dataobject.JobMachineDO;
import com.tcxhb.job.dao.dataobject.query.JobMachineQuery;
import com.tcxhb.job.common.model.PageResponse;

import java.util.List;

/**
 * author:auto.generator
 * time: 2023-11-05
 */
public interface JobMachineService {
    /**
     * 创建
     *
     * @param jobMachineDO
     * @return
     */
    Long create(JobMachineDO jobMachineDO);

    /**
     * 根据ID删除
     *
     * @param id
     * @return
     */
    boolean deleteById(Long id);

    /**
     * 更新
     *
     * @param jobMachineDO
     * @return
     */
    boolean updateById(JobMachineDO jobMachineDO);

    /**
     * 查询
     *
     * @param id
     * @return
     */
    JobMachineDO queryById(Long id);

    /**
     * 分页查询
     *
     * @param query
     * @return
     */
    PageResponse<JobMachineDO> page(JobMachineQuery query);

    /**
     * 列表查询
     *
     * @param query
     * @return
     */
    List<JobMachineDO> list(JobMachineQuery query);

    /**
     * 更新
     *
     * @param machineDO
     * @return
     */
    boolean updateByHost(JobMachineDO machineDO);

    /**
     * @param appName
     * @return
     */
    JobMachineDO queryByHost(String host, Integer prot, String appName);

    /**
     * 获取有效的机器列表
     *
     * @param app
     * @return
     */
    List<JobMachineDO> getOnlineByCache(String app);
}
